package work_three;

import static java.lang.Math.sqrt;

public class testThree {
    public static void main(String[] args) {
        long start = System.nanoTime();
        int[] nums = new int[20000];

        int t,j,i,k=0,temp=0;
        for( i=0 ;i<20000;i++)
            nums[i]=i+1;
        for( i=1;i<20000;i++)
        {
//            if(nums[i]%2==0&&nums[i]!=2)
//                continue;
            t= (int) sqrt(nums[i]);
            for(j=2;j<=t;j++){
                if(nums[i]%j==0)
                    break;
            }
            if(j==t+1)
            {
                temp++;
                System.out.print(nums[i]+" ");
                if(temp==5) {
                    System.out.println("\n");
                    temp=0;
                }
            }
        }
        long end = System.nanoTime();
        System.out.println("\n执行时间为："+(end-start)+"纳秒");

    }

}
